Skip to content

Apps contract 1: consent asked exactly as graphql asks it, under the device's or product's account - #1346

Merged
evanrbowers merged 4 commits into
apps-contract-1from
ac1/consent-rule
Nov 17, 2026
Merged

evanrbowers merged 4 commits into
apps-contract-1from
ac1/consent-rule

Conversation

@evanrbowers

@evanrbowers evanrbowers commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the open Codex finding on #1344 (product policy's consent lookup had no account) and the follow-up noted in #1345 (the portal asked for consent only for root releases).

One consent rule, graphql's

graphql on device-trust asks for consentRoot on any release that runs as root or declares capabilities (app-catalog.ts consentAsked / asksConsent), unless a consent already kept covers it (coversRootAmong). The portal asked only for root releases. So a restricted app declaring person-certificates or ssh-exec could be enabled, added, pinned or moved without the person's yes, and graphql then refused the change.

helpers/appsHelper now has the rule once:

  • consentAsked / asksConsent: root, plus each declared capability.
  • consentCovers: coversRootAmong over the catalogue's releases, newest first. If the consent's release or the target release isn't among those read, a consent counts only for its own release, so the portal asks again. That is safe: graphql keeps the newer yes.
  • productRelease: graphql's productRelease, i.e. the pin, else the channel's current, else stable's.

Every place the portal decides uses it:

Where Asks when
useAppSwitch (Apps section, app page, connect panel, device catalogue) graphql names a release awaiting consent (awaitingRoot, set for disabled apps too), or the app isn't on the device yet and its release asks
App page: channel, pin, Unpin the app is enabled and a release the change gives (addAsks) asks and isn't covered by the kept consent. A disabled app is given no release, so nothing is asked, as in graphql's turnApp
Add dialog (devices, tag, product) a release the choice gives asks
Fleet Update / Pin (app page) the release waited for or pinned asks
Product policy needsConsent; or, when turning an app on, the release the product names (read from the catalogue under the product's account) asks and the product's consent doesn't cover it

What a consent discloses

  • Several possible releases: where a change may give one of several releases (a channel's candidate or its current, depending on the device's bucket), the dialog names what all of them ask together.
  • Fleet Update: this moves devices off their pins, so it names each device's channel release (latest). It also asks for consent for a pinned device whose channel release asks for one.
  • Release not in the catalogue: if the catalogue doesn't list the release (no catalogue, an error, or older than the newest 100), the portal says what that release asks can't be read, uses root's wording, and doesn't take the yes. The Add dialog and fleet Update wait the same way.
  • The app's own fields stand in only for an app offered to the device, because there they describe the release the device would be given.

Wording

The consent dialog (RootConsent) reads whether the release it's for runs as root:

  • Root: keeps the full-control wording, with the capabilities listed beside it.
  • Restricted with capabilities: "Allow {{app}} what it asks?", saying it runs restricted, then "It asks of remote.it:" with the capabilities. The Add dialog and fleet Pin use "I allow … what it asks on these devices / every device in this product".

Status lines:

  • Device "held back" lines say "needs to run as root" only where graphql's words (needsConsentOf) or the catalogue say root. Otherwise they say "A new version asks more of remote.it".
  • Product lines say "needs your consent", because the product view doesn't say what the waiting release asks.

New keys are in en, de, es and ja. The two product keys this replaces are removed.

The account the lookup names

RootConsent, useReleaseAsks and useAppSwitch now require accountId (typed string | undefined, no longer optional), so a caller can't leave it out silently. Product policy now passes the account useProductPolicy read the product under. Every other caller already passed the device's account. The graphQLCatalogApp callers in AppPage and AppAddDialog read the active account's own catalogue, as before.

Note on graphql

ProductApp.needsConsent / awaitingRoot are only set while the app is enabled. For a product app that isn't enabled, the portal works out coverage itself from the catalogue. DeviceApp.awaitingRoot is set whether or not the app is enabled.

Tests

  • appsHelper.test: asksConsent, consentCovers (root/restricted/root, a newly declared capability, a release that wasn't read), productRelease, and the held-for-consent wording.
  • DeviceApps.test: a restricted app with capabilities asks; a covering consent turns the app on without asking; an awaitingRoot asks again.
  • DeviceAppPage.test: a channel whose release runs as root asks; a capability release asks on pin; a covering consent doesn't ask; a disabled app doesn't ask.
  • AppAddDialog.test: restricted with capabilities asks, for devices and for a product; a release asking nothing doesn't.
  • AppPage.test: fleet Update and Pin for a capability release.
  • ProductPolicyApps.test: the catalogue is read with accountId; a covering consent turns the app on directly; a consent that doesn't cover a newer release asks again; a restricted app with capabilities asks.
  • DeviceAppPage.test / AppAddDialog.test / ProductPolicyApps.test: a rolling-out candidate disclosed with the current; a release that can't be read blocks the yes.
  • AppPage.test: Update off a pin names the channel release's asks.
  • Full frontend suite (217 files, 2171 tests), tsc --noEmit, npm run i18n:extract (no diff after the commit) and npm run i18n:check all pass.

🤖 Generated with Claude Code

…ount the device or product was read for

graphql asks consentRoot of any release that runs as root or declares
capabilities (app-catalog.ts consentAsked/asksConsent), unless a consent kept
covers it (coversRootAmong). The portal asked only for root releases, so a
restricted app declaring person-certificates or ssh-exec was enabled, added,
pinned or moved without the yes, and graphql refused it.

One rule now, in helpers/appsHelper: consentAsked/asksConsent, and
consentCovers (coversRootAmong, over the catalogue's releases, newest first).
Every place the portal decides uses it:
- useAppSwitch (Apps section, app page, connect panel, device catalogue): asks
  where graphql names a release awaiting consent (awaitingRoot, enabled or not),
  or for an app not on the device yet whose release asks.
- The app page's channel, pin and Unpin: the releases the change gives
  (addAsks), asked first where one asks and the kept consent does not cover it,
  while the app is enabled.
- Add an app (devices, tag, product) and the fleet's Pin and Update.
- Product policy: needsConsent, or, turning one on, the release the product
  names (productRelease) read from the catalogue and weighed against the
  product's consent.

The words say what is asked: root's full control where the release runs as
root, else what it asks of remote.it, with its capabilities either way. Lines
that said "needs to run as root" for any consent say so only where graphql's
words or the catalogue say root.

The release-consent lookup names the account the device or product was read
under: RootConsent, useReleaseAsks and useAppSwitch take accountId as a required
argument, and the product policy page passes the account useProductPolicy read
the product under, which it omitted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@evanrbowers

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T19:49:45.929998Z 24ff748 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46aaae1055

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/pages/DeviceAppPage.tsx Outdated
Comment on lines +189 to +190
const named = asking.find(r => r.root) ?? asking[0]
if (named) return setMoving({ key, values, release: named.version })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match channel-change consent to the device's actual release

When a channel has a partially rolled-out candidate, addAsks returns both its candidate and current versions, but this code selects just one for the consent dialog, preferring whichever runs as root. For example, if current runs as root without capabilities and candidate runs restricted with ssh-exec, a device in the candidate cohort sees consent for current, with no mention of ssh-exec. Confirming then sends the channel change with consentRoot: true, authorizing the candidate's capability without showing it. Resolve the release this device will actually receive, or disclose all permissions the change can authorize rather than choosing one release's permissions.

Useful? React with 👍 / 👎.

…give

A channel rolling out a candidate gives a device its candidate or its current,
by the device's bucket, which is graphql's to compute. The app page's channel
change asked for one of them (the root one, where one was), so a candidate
declaring a capability the current does not was consented to without being
named. RootConsent and useReleaseAsks now take several releases and say what
they ask together; the channel, pin and Unpin changes name every release they
may give that asks for a consent the kept one does not cover.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@evanrbowers

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0f9237f4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/pages/AppPage.tsx Outdated
// catalogue lists them (their pin's, else their channel's).
const updateRoot = waiting.some(d => heldConsentRoot(d.heldBack!))
const updateAsks = [
...new Set(waiting.flatMap(d => app.releases.find(r => r.version === (d.pinned || d.latest))?.capabilities ?? [])),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disclose the channel release's permissions when unpinning

When a selected device is pinned and held for consent, this lookup displays the pinned release's capabilities rather than those of the channel release. However, confirming Update selected calls many({ version: '', consentRoot: true }), which clears the pin and authorizes the channel release. If those releases declare different capabilities, the dialog can therefore authorize permissions it never disclosed. Resolve the permissions of the release the update actually targets (latest after unpinning), including its root requirement, instead of preferring d.pinned.

Useful? React with 👍 / 👎.

…ves to asks

Update selected unpins the devices (version ""), moving each to the release its
channel gives it (latest). Its consent named the pinned release's capabilities,
and asked only for devices held for consent: a device pinned elsewhere was moved
to a release asking more without the yes, and graphql refused it. It now asks
where a device is held for consent or would move off a pin to a release that
asks, and names what those latest releases ask together (root as graphql's
held-back words say where the catalogue does not list one).

The tests no longer change the shared catalogue fixture's releases in place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@evanrbowers

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d626dfc8d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +153 to +154
const entry = listed.find(r => r.version === version)
return entry ? { root: entry.root, capabilities: entry.capabilities } : own

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep consent blocked when target permissions cannot be read

When a restricted app is held for a newer root release and the catalogue lookup fails or omits that release, this fallback substitutes the currently offered app's root: false and capabilities. RootConsent then enables confirmation and explicitly says the app runs restricted, but confirming through useAppSwitch still sends { consentRoot: true }, authorizing the root release without disclosing its full control. Previously the dialog always disclosed root access. Keep confirmation blocked when a named target's permissions are unknown, rather than treating the current release's permissions as the target's.

Useful? React with 👍 / 👎.

…and no yes is taken for it

Where the catalogue did not answer for the release a consent was for (an API
without one, an error, a release older than those read), the portal showed the
app's own fields instead: the release it runs, not the one the yes moves it to.
A restricted app held for a root release was then asked as restricted, and the
yes still authorized root.

What a named release asks is now known or not: useReleaseAsks answers null for
one the catalogue does not list, and RootConsent says so ("What this version
asks could not be read …"), words for root, and keeps the yes. addAsks says
known: false for a release not read and the Add dialog waits; the fleet's
Update waits likewise; the app page's channel and pin ask for a release not
read rather than skipping it. The app's own fields are used only where they are
the release in question: an app offered to the device, whose fields are what
its release asks there. useAppSwitch names awaitingRoot alone, as graphql's
DeviceApp capabilities describe the release given, not the one awaited.

The device app page and the Add dialog read the newest 100 releases, as the
consent lookup does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@evanrbowers

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 24ff748dc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@evanrbowers
evanrbowers merged commit 6c23c18 into apps-contract-1 Nov 17, 2026
2 checks passed
@evanrbowers
evanrbowers deleted the ac1/consent-rule branch November 17, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant